package ccf201903;

import java.util.Scanner;

/**
 * 损坏的RAID5<br>
 * 
 * @author wangx
 *
 */
public class Q03 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// n 磁盘数目 s 阵列条带大小 l 现存磁盘数目
		int n = sc.nextInt();
		int s = sc.nextInt();
		int l = sc.nextInt();

		sc.nextLine();

		// 磁盘数据
		String[] disks = new String[l];
		for (int i = 0; i < l; ++i) {
			String[] line = sc.nextLine().split(" ");
			disks[Integer.valueOf(line[0])] = line[1];
		}

		// 查询数据
		int m = sc.nextInt();
		int[] block = new int[m];
		for (int i = 0; i < m; ++i) {
			block[i] = sc.nextInt();
		}

		for (int blockNum : block) {
			// 可以分步求出block块所在的磁盘和条带
			int diskNum = diskNum(n, s, blockNum);
			int k = tieNum(n, s, blockNum);

		}

		System.out.println("  ");
	}

	/**
	 * 获取块所在磁盘编号
	 * 
	 * @param diskCount
	 * @param s
	 * @param blockNum
	 * @return
	 */
	private static int diskNum(int diskCount, int s, int blockNum) {
		return blockNum % (diskCount * s);
	}

	/**
	 * 获取块所在条带编号
	 * 
	 * @param diskCount
	 * @param s
	 * @param blockNum
	 * @return
	 */
	private static int tieNum(int diskCount, int s, int blockNum) {
		return blockNum / ((diskCount - 1) * s);
	}

}
